import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter_boost/boost_navigator.dart';

class PageOne extends StatefulWidget {
  @override
  _PageOneState createState() => _PageOneState();
}

class _PageOneState extends State<PageOne> {
  var returnParams = "null";
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("界面一"),
      ),
      body: Container(
        child: Center(
          child: ElevatedButton(
            child: Text("打开native界面: $returnParams"),
            onPressed: () {
              BoostNavigator.instance.push("native_page_one",
                  arguments: {"param": "Im from flutter page"}).then((value) {
                print("=====vvvvv======");
                print(value);
                print("=====vvvvv======");
                setState(() {
                  returnParams = value.toString();
                });
              });
              // BoostNavigator.instance.push(
              //   "page_two", //required
              //   withContainer: false, //optional
              //   arguments: {"kkkk": "vvvv"}, //optional
              //   opaque: true, //optional,default value is true
              // );
              ///or
              // Navigator.of(context)
              //     .pushNamed('page_two', arguments: {"kkkk": "vvvv"});
            },
          ),
        ),
      ),
    );
  }
}
